<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改生产型号')" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-erpModel-edit" th:object="${erpModel}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">生产型号：</label>
                <div class="col-sm-8">
                    <input name="modeNo" th:field="*{modeNo}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">生产型号名称：</label>
                <div class="col-sm-8">
                    <input name="modeName" th:field="*{modeName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">产品分类：</label>
                <div class="col-sm-8">
                    <select name="modeType" class="form-control m-b" th:with="type=${@dict.getType('erp_mode_type')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{modeType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">生产pcb文件：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="pcbFile" th:field="*{pcbFile}">
                    <a class="btn btn-xs" th:href="*{pcbFile}"><i class="fa fa-download">点击下载</i></a>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">生产机器文件：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="machineFile" th:field="*{machineFile}">
                    <a class="btn btn-xs" th:href="*{machineFile}"><i class="fa fa-download">点击下载</i></a>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">长度：</label>
                <div class="col-sm-8">
                    <input name="length" th:field="*{length}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">宽度：</label>
                <div class="col-sm-8">
                    <input name="wide" th:field="*{wide}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">版厚：</label>
                <div class="col-sm-8">
                    <select name="thickness" class="form-control m-b" th:with="type=${@dict.getType('erp_thickness')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{thickness}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">层数：</label>
                <div class="col-sm-8">
                    <select name="layerNum" class="form-control m-b" th:with="type=${@dict.getType('erp_layer_num')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{layerNum}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">基材：</label>
                <div class="col-sm-8">
                    <select name="baseMaterial" class="form-control m-b" th:with="type=${@dict.getType('erp_baseMaterial')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{baseMaterial}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">外层铜厚：</label>
                <div class="col-sm-8">
                    <select name="outerThickness" class="form-control m-b" th:with="type=${@dict.getType('erp_outerThickness')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{outerThickness}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">内层铜厚：</label>
                <div class="col-sm-8">
                    <select name="innerThickness" class="form-control m-b" th:with="type=${@dict.getType('erp_outerThickness')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{innerThickness}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">焊盘喷镀：</label>
                <div class="col-sm-8">
                    <select name="solderCoating" class="form-control m-b" th:with="type=${@dict.getType('erp_solderCoating')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{solderCoating}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">阻焊颜色：</label>
                <div class="col-sm-8">
                    <select name="solderColor" class="form-control m-b" th:with="type=${@dict.getType('erp_solderColor')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{solderColor}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">字符颜色：</label>
                <div class="col-sm-8">
                    <select name="characterColor" class="form-control m-b" th:with="type=${@dict.getType('erp_characterColor')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{characterColor}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">成形：</label>
                <div class="col-sm-8">
                    <select name="shapingStyle" class="form-control m-b" th:with="type=${@dict.getType('erp_shapingStyle')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{shapingStyle}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">测试：</label>
                <div class="col-sm-8">
                    <select name="testStyle" class="form-control m-b" th:with="type=${@dict.getType('erp_testStyle')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{testStyle}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">过孔：</label>
                <div class="col-sm-8">
                    <select name="viaHole" class="form-control m-b" th:with="type=${@dict.getType('erp_viaHole')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{viaHole}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">规格：</label>
                <div class="col-sm-8">
                    <input name="spec" th:field="*{spec}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">单元尺寸：</label>
                <div class="col-sm-8">
                    <input name="unitSize" th:field="*{unitSize}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">拼版尺寸：</label>
                <div class="col-sm-8">
                    <input name="makeUpSize" th:field="*{makeUpSize}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">拼板款数：</label>
                <div class="col-sm-8">
                    <input name="makeModeNum" th:field="*{makeModeNum}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否阻抗：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
                        <input type="radio" th:id="${'isImpedance_' + dict.dictCode}" name="isImpedance" th:value="${dict.dictValue}" th:field="*{isImpedance}">
                        <label th:for="${'isImpedance_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">阻焊覆盖：</label>
                <div class="col-sm-8">
                    <input name="solderCover" th:field="*{solderCover}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">最小孔径：</label>
                <div class="col-sm-8">
                    <input name="minAperture" th:field="*{minAperture}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">外径：</label>
                <div class="col-sm-8">
                    <input name="outerDiameter" th:field="*{outerDiameter}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">线路测试：</label>
                <div class="col-sm-8">
                    <input name="lineTest" th:field="*{lineTest}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">否需要斜边：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
                        <input type="radio" th:id="${'hypotenuse_' + dict.dictCode}" name="hypotenuse" th:value="${dict.dictValue}" th:field="*{hypotenuse}">
                        <label th:for="${'hypotenuse_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        // 详情禁用所有input
        $(":input").attr("disabled", "disabled");

        var prefix = ctx + "erp/erpModel";
        $("#form-erpModel-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-erpModel-edit').serialize());
            }
        }

        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val()
            $(this).fileinput({
                'uploadUrl': ctx + 'common/upload',
                initialPreviewAsData: true,
                initialPreview: [val],
                maxFileCount: 1,
                autoReplace: true
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });
    </script>
</body>
</html>